## Add the AMO namespace
$loadInfo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")

## Connect and get the edition of the local server
$connection = "localhost"
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($connection)

foreach ($d in $server.Databases ) 
{
 Write-Output ( "`nDatabase: {0}`nSize: {1}`n" -f 
    $d.Name, $d.EstimatedSize )
}
